package com.horse.cloud.data.access;

import java.util.List;

/**
 * @createte Created by intelliJ IDEA 16.1.1 .
 * @author bing.Pan
 * @e-mail 15923508369@163.com .
 * @gmdate   2016/12/29 16:04
 * @sidesc   通用Mapper接口实现了基本的增删改查
 */

public interface BaseMapper<T, E> {


    /**
     * 根据主键Id删除数据
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     id 数据库主键id
     * @return
     */
    int deleteByPrimaryKey(String id);


    /**
     * 新增记录(如果实体类字段为空或null不过滤)
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record  数据库表对应实体类
     * @return
     */
    int insert(T record);

    /**
     * 新增记录(过滤掉实体字段为空或为null的值)
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record 数据库表对应实体类
     * @return
     */
    int insertSelective(T record);

    /**
     * 根据主键字段获取数据
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     id 数据库主键id
     * @return
     */
    T selectByPrimaryKey(long id);


    /**
     * 根据主键修改记录(过滤掉实体字段为空或为null的值)
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record 数据库表对应实体类
     * @return
     */
    int updateByPrimaryKeySelective(T record);


    /**
     * 根据主键修改记录(如果实体类字段为空或null不过滤)
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record 数据库表对应实体类
     * @return
     */
    int updateByPrimaryKey(T record);

    /**
     * 查询所有不带条件
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @return
     */
    List<T> findList();

    /**
     * 根据自定义条件查询List集合
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record 自定义类型
     * @return
     */
    List<T> findListByE(E record);


    /**
     * 根据条件查询List集合
     * @createte  Created by intelliJ IDEA
     * @author    bing.Pan
     * @e-mail    15923508369@163.com
     * @gmdate    Sat Mar 24 18:59:05 CST 2018
     * @param     record 数据库表对应实体类
     * @return
     */
    List<T> findListByT(T record);


}
